from django.db import models


class Tag(models.Model):
    tagname = models.CharField('标签名', max_length=50)
    def __str__(self):
        return self.tagname


class Article(models.Model):
    articletitle = models.CharField('文章标题', max_length=20)
    articlebody = models.TextField('文章内容')
    articletag = models.ManyToManyField(Tag, blank=True)
    articlecreate_time = models.DateTimeField('文章创建时间', auto_now_add=True)
    articlemodify_time = models.DateTimeField('文章标题修改时间', auto_now_add=True)
    def __str__(self):
        return self.articletitle